package main

import (
	"log"
	"net/url"

	"github.com/zserge/lorca"
)

func main() {
	// Create UI with basic HTML passed via data URI
	ui, err := lorca.New("data:text/html,"+url.PathEscape(`
	<html>
		<meta charset="utf-8">
		<head><title>Hello</title></head>
		<style>
		input{
			margin:5px;
		}
		</style>
		<body>
		<h1>Hello, world!哈哈</h1>
		<form>
		姓名：<input type="text" name="user"><br>
		年龄：<input type="text" name="age"><br>
		<input type="submit" value="登录" onclick="alert(1);">
		</form>
		</body>
	</html>
	`), "", 480, 320)
	if err != nil {
		log.Fatal(err)
	}
	defer ui.Close()
	// Wait until UI window is closed
	<-ui.Done()
}
